package com.ppl.server.modules;

import com.github.jmkgreen.morphia.Datastore;
import com.github.jmkgreen.morphia.Morphia;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Singleton;
import com.ppl.server.db.DatastoreProvider;
import com.ppl.server.db.MorphiaProvider;

/**
 * Created with IntelliJ IDEA.
 * User: Vincent
 * Date: 11/5/12
 * Time: 12:21 PM
 * To change this template use File | Settings | File Templates.
 */
public class DBModule  extends AbstractModule{
    @Inject
    public static Injector injector;

    @Override
    protected void configure() {
        bind(Morphia.class).toProvider(MorphiaProvider.class).in(Singleton.class);
        bind(Datastore.class).toProvider(DatastoreProvider.class).in(Singleton.class);

        requestStaticInjection(DBModule.class);
    }
}
